package com.ruoyi.common.service.business.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.core.pagination.Paging;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ruoyi.common.core.pagination.PageInfo;
import com.ruoyi.common.param.NoticeParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.mapper.business.NoticeMapper;
import com.ruoyi.common.domain.business.Notice;
import com.ruoyi.common.service.business.NoticeService;

/**
 * 通知Service业务层处理
 *
 * @author Song
 * @date 2024-10-29
 */
@Service
public class NoticeServiceImpl extends ServiceImpl<NoticeMapper, Notice> implements NoticeService {

    @Autowired
    private NoticeMapper noticeMapper;

    /**
     * 查询通知列表
     *
     * @param notice 通知
     * @return 通知
     */
    public Paging<Notice> pageNotice(NoticeParam notice) {
        LambdaQueryWrapper<Notice> wrapper = new LambdaQueryWrapper<Notice>();
        Page<Notice> page = new PageInfo<>(notice);
        IPage<Notice> iPage = this.page(page, wrapper);
        // 最终返回分页对象
//        IPage<NoticeVo> resultPage = iPage.convert(item -> {
//            NoticeVo vo = new NoticeVo();
//            BeanUtil.copyProperties(item, vo);
//            return vo;
//        });
        return new Paging(iPage);
    }
}



